<?php
set_time_limit(0);
include '../c/config.php';
$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
 
$theday=date("Y-m-d", strtotime("-1 day"));
$theday=date("Y-m-d");

$sql="select count(id) as xi from `zsu_xijun_log` where lei=1 and createtime like '".$theday."%' ";
$querypv=$mysqli->query($sql);
$getData=$querypv->fetch_assoc();
$thexijun=$getData['xi']; //细菌

$sql="select count(id) as yi from `zsu_xijun_log` where lei=2 and createtime like '".$theday."%' ";
$querypv=$mysqli->query($sql);
$getData=$querypv->fetch_assoc();
$theysbing=$getData['yi']; //易生病


$sql="select count(id) as bing from `zsu_xijun_log` where lei=3 and createtime like '".$theday."%' ";
$querypv=$mysqli->query($sql);
$getData=$querypv->fetch_assoc();
$thebingdu=$getData['bing']; //病毒


$sql="select count(id) as count from `zsu_xijun_log` where lei=4 and createtime like '".$theday."%' ";
$querypv=$mysqli->query($sql);
$getData=$querypv->fetch_assoc();
$thedanao=$getData['count']; //大脑


$sql="select count(id) as count from `zsu_xijun_log` where lei=5 and createtime like '".$theday."%' ";
$querypv=$mysqli->query($sql);
$getData=$querypv->fetch_assoc();
$thechangwei=$getData['count']; //肠胃


$sql="select id from `zsu_xijun_tong` where lei=1 and theday='".$theday."'  limit 0,1 ";
$query = $mysqli->query($sql);
if($query->num_rows>0){}else{  
    $mysqli->query("INSERT INTO `zsu_xijun_tong` (`id`, `lei`, `ci`, `theday`) VALUES (NULL, 1,".$thexijun.",'".$theday."' )");
}

$sql="select id from `zsu_xijun_tong` where lei=2 and theday='".$theday."'  limit 0,1 ";
$query = $mysqli->query($sql);
if($query->num_rows>0){}else{  
    $mysqli->query("INSERT INTO `zsu_xijun_tong` (`id`, `lei`, `ci`, `theday`) VALUES (NULL, 2,".$theysbing.",'".$theday."' )");
}

$sql="select id from `zsu_xijun_tong` where lei=3 and theday='".$theday."'  limit 0,1 ";
$query = $mysqli->query($sql);
if($query->num_rows>0){}else{  
    $mysqli->query("INSERT INTO `zsu_xijun_tong` (`id`, `lei`, `ci`, `theday`) VALUES (NULL, 3,".$thebingdu.",'".$theday."' )");
}
 

$sql="select id from `zsu_xijun_tong` where lei=4 and theday='".$theday."'  limit 0,1 ";
$query = $mysqli->query($sql);
if($query->num_rows>0){}else{  
    $mysqli->query("INSERT INTO `zsu_xijun_tong` (`id`, `lei`, `ci`, `theday`) VALUES (NULL, 4,".$thedanao.",'".$theday."' )");
}

$sql="select id from `zsu_xijun_tong` where lei=5 and theday='".$theday."'  limit 0,1 ";
$query = $mysqli->query($sql);
if($query->num_rows>0){}else{  
    $mysqli->query("INSERT INTO `zsu_xijun_tong` (`id`, `lei`, `ci`, `theday`) VALUES (NULL, 5,".$thechangwei.",'".$theday."' )");
}

 
echo 1;
 
$mysqli->close();
    
 
?>